package kr.hkit.powerjava.chapter10;

import java.util.Scanner;

class Reservation{
	Scanner input = new Scanner(System.in);
	private int[] guest = new int[10];
	private int n;
	private int guestNum;
	
	public void getGuest(){
		while(true){
			System.out.print("좌석을 예약하시겠습니까??(1 또는 0)");
			n = input.nextInt();
			if(n == 1){
				System.out.println("현재의 예약 상태는 다음과 같습니다.");
				System.out.println("--------------------------------------");
				System.out.println("1 2 3 4 5 6 7 8 9 10");
				System.out.println("--------------------------------------");
				for(int i = 0; i < guest.length; i++){
					System.out.print(guest[i] + " ");
				}
				System.out.println("\n몇 번째 좌석을 예약하시겠습니까?");
				guestNum = input.nextInt();
				if(guest[guestNum-1] == 0){
					guest[guestNum-1] = 1;
					System.out.println("예약되었습니다.");
				}else{
					System.out.println("이미 예약된 좌석입니다.");
				}
			}else{
				System.out.println("종료되었습니다.");
				break;
			}
		}
	}
}

public class ReservationTest {
	public static void main(String[] args) {
		Reservation re = new Reservation();
		re.getGuest();
	}
}
